function GameRoll(stage, number, elementNames) {
	this.stage = stage;
	this.number = number;
	this.elementNames = elementNames;

	this.size = 3;
	this.elements = [];
	this.isElementsVisible = null;
	this.spinningDelay = this.number * 100;

	this.animation = new createjs.BitmapAnimation(this.spriteSheet);

	this.stage.addChild(this.animation);
	this.renewElements();
	this.showElements();
}

GameRoll.prototype.spriteSheet = new createjs.SpriteSheet({
	animations:{
		idle:[-1, -1],
		spin:[0, 12]
	},
	images:["images/game_ims_reels_blurred.png"],
	frames:{
		height:383,
		width:127,
		regX:0,
		regY:0,
		count:13
	}
});

GameRoll.prototype.getContent = function () {
	var result = [];
	for (var i = 1, iLength = this.elements.length - 1; i < iLength; i++) {
		result.push(this.elements[i].name);
	}
	return result;
};

GameRoll.prototype.hideElements = function () {
	if (!this.isElementsVisible) {
		return;
	}

	for (var i = this.elements.length; i--;) {
		this.elements[i].hide();
	}
	this.isElementsVisible = false;
};

GameRoll.prototype.showElements = function () {
	if (this.isElementsVisible) {
		return;
	}

	for (var i = this.elements.length; i--;) {
		this.elements[i].show();
	}
	this.isElementsVisible = true;
};

GameRoll.prototype.renewElements = function () {
	for (var i = this.elements.length; i--;) {
		this.elements[i].destruct();
		this.elements[i] = null;
	}

	this.elements = [];

	var elementsSet = GameHelper.getRandElements(this.elementNames, this.size + 2);
	for (var i = this.size + 2; i--;) {
		var element = new elementsSet[i](this.stage, false);
		element.setPosition(0, (i - 1) * 128);
		this.elements.push(element);
	}
};

GameRoll.prototype.startAnimation = function () {
	this.hideElements();
	this.stage.y = 0;
	this.animation.gotoAndPlay('spin');
	this.renewElements();
};

GameRoll.prototype.stopAnimation = function () {
	this.stage.y = 0;
	this.showElements();
	this.animation.gotoAndPlay('idle');
};

GameRoll.prototype.spin = function (callback) {
	callback = callback || dummyFunction;

	var _this = this;

	createjs.Tween.get(this.stage)
		.wait(this.spinningDelay)
		.to({y:-20}, 300)
		.to({y:0}, 10)
		.call(function () {
			_this.startAnimation()
		})
		.wait(500)
		.call(function () {
			_this.stopAnimation();
		})
		.to({y:50}, 100)
		.to({y:0}, 50)
		.call(callback);
};